﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html"; charset="utf-8" />
<title></title>
<link href="/xiaozu/css/main.css" rel="stylesheet" type="text/css">
    <link href="/xiaozu/bstable/css/bootstrap.min.css" rel="stylesheet" type="text/css">
    <link href="/xiaozu/bstable/css/bootstrap-table.css" rel="stylesheet" type="text/css">

</head>
<body>
<div class="tabe_div">
    <form action="<%=request.getContextPath()%>/store/basic" method="post">
    <p class="p_line text_ient"><a class="find_a">名称：</a><input type="text" value="${ss_shop_Store}" name="find" class="form_input text_ient" placeholder="输入名称"/>
    <a  class="find_a">类型：</a>
    <select class="form_select" name="opt" style="padding-left: 1%;">
        <option <c:if test="${ss_shop_Type == '0'}">selected="selected"</c:if> value="0">全部</option>
        <option <c:if test="${ss_shop_Type == '1'}">selected="selected"</c:if> value="1">餐饮</option>
        <option <c:if test="${ss_shop_Type == '2'}">selected="selected"</c:if> value="2">家居建材</option>
        <option <c:if test="${ss_shop_Type == '3'}">selected="selected"</c:if> value="3">饰品</option>
    </select>
    <input type="submit" value="查询" class="but_find"/><p>
    </form>
    <p class="p_table">
    <a href="#" class="a_add" id="add_box" onclick="tianjia()">添加</a><a href="#" class="a_add">全部导出</a>
</p>


    <table id="table" class="table_style" style="margin: 0 auto" >
        <c:forEach var="shop" items="${s_shopList}">
            <tr>
                <td>${shop.ss_shop_Id}</td>
                <td>${shop.ss_shop_Store}</td>
                <td>
                    <c:if test="${shop.ss_shop_Type=='1'}">餐饮</c:if>
                    <c:if test="${shop.ss_shop_Type=='2'}">家居建材</c:if>
                    <c:if test="${shop.ss_shop_Type=='3'}">饰品</c:if>
                </td>
                <td><fmt:formatDate value="${shop.ss_shop_Createtime}" pattern="yyyy-MM-dd"/></td>
                <td>${shop.ss_shop_Phone}</td>
                <td>${shop.ss_shop_Address}</td>
            </tr>
        </c:forEach>
    </table>
</div>
<div></div>
<script src="/xiaozu/js/jquery.js"></script>
<script src="/xiaozu/js/date/js/laydate.js"></script>
<script src="/xiaozu/bstable/js/bootstrap.min.js"></script>
<script src="/xiaozu/bstable/js/bootstrap-table.js"></script>
<script src="/xiaozu/bstable/js/bootstrap-table-zh-CN.min.js"></script>
<script>
    !function () {
        laydate.skin('danlan'); //切换皮肤，请查看skins下面皮肤库
        laydate({ elem: '#demo' });
        laydate({ elem: '#demo1' }); //绑定元素
    } ();
</script>

<script type="text/javascript">
    $(function() {
        $('#table')
            .bootstrapTable({
                method: "get",
                striped: true,
                singleSelect: false,
                url: "/xiaozu/json/storeBasic.json",
                dataType: "json",
                pagination: true, //分页
                pageSize: 10,
                pageNumber: 1,
                search: false, //显示搜索框
                contentType: "application/x-www-form-urlencoded",
                queryParams: null,
                columns: [
                    {
                        title: "编号",
                        field: 'id',
                        align: 'center',
                        valign: 'middle'
                    },
                    {
                        title: '餐馆名称',
                        field: 'name',
                        align: 'center',
                        valign: 'middle'
                    },
                    {
                        title: '类型',
                        field: 'type',
                        align: 'center'
                    },
                    {
                        title: '建立时间',
                        field: 'buildTime',
                        align: 'center'
                    },
                    {
                        title: '联系电话',
                        field: 'phone',
                        align: 'center'
                    },
                    {
                        title: '详细地址',
                        field: 'address',
                        align: 'center'
                    },
                    {
                        title: '操作',
                        field: 'oper',
                        align: 'center',
                        formatter: function(value, row) {
                            var e = '<button button="#" mce_href="#"onclick="openlayer(\'' +
                                row.id +
                                '\')">编辑</button> ';
                            var d = '<button button="#" mce_href="#"  value="' +row.id +'" onclick="deleteHotel(this)">删除</button> ';
                            var c = '<button button="#" mce_href="#" value="' +row.id +'" onclick="showHotelInfo(this)">详细信息</button> ';
                            return e + d + c;
                        }
                    }
                ]
            });
    });

    function addHotel() {
        this.location.href = "addStore.jsp";
    }

    function editHotel(id) {
        this.location.href = "addStore.jsp";
    }

    function showHotelInfo() {
        this.location.href = "addStore.jsp";
    }

</script>
<script src="/xiaozu/layer_v2.1/layer/layer.js"></script>
<script type="text/javascript">
    function tianjia(id) {

        layer.open({
            type: 2,
            title: '添加旅行社信息',
            shadeClose: true,
            shade: 0.5,
            skin: 'layui-layer-rim',
            //            maxmin: true,
            closeBtn: 1,
            area: ['80%', '75%'],
            shadeClose: true,
            closeBtn: 1,
            content: '../store/add',
            end:function () {
                location.reload();
            }

            //iframe的url
        });
    }
    function openlayer(id) {
        layer.open({
            type: 2,
            title: '添加酒店信息',
            shadeClose: true,
            shade: 0.5,
            skin: 'layui-layer-rim',
            //            maxmin: true,
            closeBtn: 1,
            area: ['80%', '75%'],
            shadeClose: true,
            closeBtn: 1,
            content: '../store/modifyStore?ss_shop_Id='+id,
            end:function () {
                location.reload();
            }

            //iframe的url
        });
    }

//    function editHotel(id) {
//        layer.open({
//            type: 2,
//            title: '酒店信息',
//            shadeClose: true,
//            shade: 0.5,
//            skin: 'layui-layer-rim',
//            //            maxmin: true,
//            closeBtn: 1,
//            area: ['80%', '75%'],
//            shadeClose: true,
//            closeBtn: 1,
//            content: 'editHotel.html'
//            //iframe的url
//        });
//    }

    function deleteHotel(dom) {
        var kl=$(dom).val();
        $.ajax({
            type:"post",
            url:"${pageContext.request.getContextPath()}/store/shanchu",
            data: "id="+kl,
            success:function(data){
                window.location.href='${pageContext.request.getContextPath()}/store/basic';
            },
            error:function(){
                alert("shibai!");
                           }

        });


    }
    function showHotelInfo(id) {
        var kl=$(id).val();
        layer.open({
            type: 2,
            title: '查看当前信息',
            shadeClose: true,
            shade: 0.5,
            skin: 'layui-layer-rim',
            //            maxmin: true,
            closeBtn: 1,
            area: ['80%', '75%'],
            shadeClose: true,
            closeBtn: 1,
            content: '../store/viewHotel?ss_shop_Id='+kl,
            end:function () {
                location.reload();
            }

            //iframe的url
        });
    }
</script>
</body>
</html>
